#pragma once
#include <direct.h>
#include <iostream>
#include <windows.h>
#include "RegDM.h"
#include <string>
#include <list>
#include <vector>
#include <map>
#include "state.h"
class CMemLib
{
public:
	CMemLib();
	CMemLib(DWORD pid);
	bool InitProcess(DWORD pid);
	virtual ~CMemLib();
	void  SetOffSetValues(int off1);
	void  SetOffSetValues(int off1,int off2);
	void  SetOffSetValues(int off1, int off2, int off3);
	void  SetOffSetValues(int off1, int off2, int off3, int off4);
	void  SetOffSetValues(int off1, int off2, int off3, int off4, int off5);
	void  SetOffSetValues(int off1, int off2, int off3, int off4, int off5, int off6);
	void  SetOffSetValues(int off1, int off2, int off3, int off4, int off5, int off6, int off7);
	bool  GetDataFromAddress(DWORD pBase, int num, DWORD * word);//标志，1为整形，2为字符串，3
	bool  GetDataFromAddress(DWORD pBase, int num, char *str, int len);//
	bool  GetDataFromAddress(DWORD pBase, int num, DWORD64 * word);//读取8字节
	bool  GetDataFromAddress(DWORD pBase, int num, WORD * word);//读取2字节
	bool  GetDataFromAddress(DWORD pBase, int num, BYTE * word);//读取1字节
	//bool BaseAddressSeach(BYTE  *byte);//基址搜索,使用字符数组
protected:
	HANDLE hProcess;
	HANDLE hHeap; //堆，用来申请内存
	int offset[10];//用来取偏移地址时用，最多10级
	int offNum;//偏移次数
	void InitOffSet();
	HANDLE m_hMutex; //互斥
};